package com.dqx.opengl_es_demo.camera;

import android.content.Context;
import android.opengl.GLSurfaceView;
import android.util.AttributeSet;

/**
 * 预览控件
 */
public class CameraGLSurfaceView extends GLSurfaceView {
    //渲染器
    CameraRenderer renderer;

    public CameraGLSurfaceView(Context context) {
        this(context, null);
    }

    public CameraGLSurfaceView(Context context, AttributeSet attrs) {
        super(context, attrs);
        //设置OpenGL ES2.0版本的上下文
        setEGLContextClientVersion(2);
        //初始化渲染器
        renderer = new CameraRenderer(getContext());
        //设置渲染器
        setRenderer(renderer);
        //设置渲染模式为不断渲染
        setRenderMode(CameraGLSurfaceView.RENDERMODE_CONTINUOUSLY);
    }
}
